package com.shy.springframework.test.bean;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

/**
 * @author yzpang
 * @desc: 用户服务方法拦截器
 * @date: 2023/2/10 14:48
 */
public class UserServiceInterceptor implements MethodInterceptor {
    @Override
    public Object invoke(MethodInvocation invocation) throws Throwable {
        System.out.println("方法执行前: " + System.currentTimeMillis());
        try {
            return invocation.proceed();
        }finally {
            System.out.println("方法执行后: " + System.currentTimeMillis());
        }
    }
}
